﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="rs" uri="http://www.demo2do.com/taglib/core"%>
<!DOCTYPE html>
<html>
  <head>
  	
  	<%@ include file="/WEB-INF/include/meta.jsp" %>
  	<%@ include file="/WEB-INF/include/css.jsp" %>
  	<link href="${ctx.resource}/css/font-awesome.min.css" rel="stylesheet">
	
	<title>创业项目 - 众投湾</title>
	
	<fmt:setBundle basename="ApplicationMessage"/>
	<fmt:setLocale value="zh_CN"/>
	
  </head>

  <body>
  
	<%@ include file="/WEB-INF/include/header.jsp" %>
	
	  <div class="container">
	    <div class="zz-startup-content">
	      
	      <div class="col-md-4 zz-startup-left-layout">
	        
	        <div class="zz-vertical-filter">
	        
	          <form class="form-horizontal zz-search-form" method="get" action="${ctx}/startups" name="filter-form">
	            <div class="form-group zz-form-group">
	              <div class="input-group">
	                <input type="text" name="name" class="form-control" placeholder="找项目" value="${name}">
	                <span class="input-group-btn">
	                  <button class="btn btn-success btn-shadow btn-shadow-success" type="submit"><i class="fa fa-search fa-lg"></i>&nbsp;搜索</button>
	                </span>
	              </div>
	            </div>
	            <input type="hidden" name="tid" value="${tid}">
	            <input type="hidden" name="rid" value="${rid}">
	            <input type="hidden" name="fsid" value="${fsid}">
	          </form>
	          
	          <ul class="nav nav-pills nav-stacked zz-nav-stacked">
	            <li class="active"><a href="#">全部项目<span class="badge pull-right">${startupCount}</span></a></li>
	          </ul>
	        </div>
	        
	      </div><!-- zz-startup-left-layout -->
	      
	      <div class="col-md-8 zz-startup-right-layout">
	        
	        <div class="zz-horizontal-filter">
	          <div class="container">
	            
	            <div class="zz-filter-row clearfix">
	              <div class="zz-filter-row-header"><b>行业：</b></div>
	              <div class="zz-filter-row-options">
	                <ul class="list-inline no-bottom-margin" id="tag-filters">
	                  <li class="${tid == 0 ? 'active' : ''}"><a href="javascript: void(0)" rel="0">全部</a></li>
	                  <c:forEach var="tag" items="${tags}">
	                    <li class="${tid == tag.id ? 'active' : ''}"><a href="javascript: void(0)" rel="${tag.id}">${tag.name}</a></li>
	                  </c:forEach>
	                </ul>
	              </div>
	            </div>
	              
	            <div class="zz-filter-row clearfix">
                  <div class="zz-filter-row-header"><b>地区：</b></div>
                  <div class="zz-filter-row-options">
                    <ul class="list-inline no-bottom-margin" id="region-filters">
                      <li class="${rid == 0 ? 'active' : ''}"><a href="javascript: void(0)" rel="0">全部</a></li>
                      <c:forEach var="region" items="${regions}">
                        <li class="${rid == region.id ? 'active' : ''}"><a href="javascript: void(0)" rel="${region.id}">${region.name}</a></li>
                      </c:forEach>
                    </ul>
                  </div>
                </div>
                
                <div class="zz-filter-row clearfix">
                  <div class="zz-filter-row-header"><b>状态：</b></div>
                  <div class="zz-filter-row-options">
                    <ul class="list-inline no-bottom-margin" id="fund-status-filters">
                      <li class="${fsid == '0' ? 'active' : ''}"><a href="javascript: void(0)" rel="0">全部</a></li>
                      <c:forEach var="fundStatus" items="${startupFundStatusFilter}">
                        <li class="${fsid == fundStatus.ordinal ? 'active' : ''}"><a href="javascript: void(0)" rel="${fundStatus.ordinal}"><fmt:message key="${fundStatus.key}"/></a></li>
                      </c:forEach>                    
                    </ul>
                  </div>
                </div>
	            
	          </div>
	        </div><!-- zz-horizontal-filter -->
	        
	        <div class="zz-sort-bar">
	          <ul class="list-inline zz-sort-options">
	          </ul>
	          
	          <div class="zz-sort-result">为您搜索到&nbsp;<b style="color: #ff8111;">${startupCount}</b>&nbsp;个创业项目</div>
	        </div><!-- zz-sort-bar -->
	        
	        <div class="zz-item-list">
	        
	          <c:forEach var="startup" items="${startups}">
	            <div class="zz-item-cell clearfix">
	            
	              <img class="img-rounded" src="${ctx.upload}/${startup.profile.avatar}">
	              
	              <div class="zz-startup-cell-right">
	                <h4 class="no-top-margin text-prefunding">综合评分</h4>
	                <div class="show-rating display-inline-block" data-score="${startup.averageRating}"></div>&nbsp;<span class="show-rating-hint label label-success"></span>
	                <hr class="top-margin-10 bottom-margin-10">
	              </div><!-- zz-startup-cell-right -->
	              
	              <div class="zz-startup-cell-center">
	                <h3 class="item-title line-ellipsis">
	                  <a href="${ctx}/startups/${startup.id}">${startup.profile.name}</a>&nbsp;<small title="${startup.profile.alias}">${startup.profile.alias}</small>&nbsp;
	                </h3>
	                <c:if test="${startup.fundStatus.asRedisKey }">
	                  <span class="badge zz-bg-${startup.fundStatus.alias}"><fmt:message key="${startup.fundStatus.key}" /></span>
	                </c:if>
	                <p class="box-ellipsis startup-description">${startup.profile.description}</p>
                    <p class="text-light-gray line-ellipsis">
                      <i class="fa fa-map-marker fa-lg" title="地区"></i>&nbsp;${startup.profile.region}&nbsp;&nbsp;
                      <i class="fa fa-tags fa-lg" title="行业"></i>&nbsp;
                      <c:forEach var="tag" items="${startup.tags}" varStatus="count">
	                    <c:choose>
	                      <c:when test="${count.index == 0}">${tag}</c:when>
	                      <c:otherwise><b>&nbsp;·&nbsp;</b>${tag}</c:otherwise>
	                    </c:choose>
	                  </c:forEach>
                    </p>
                    <div class="startup-social-data top-margin-10">
                      <ul class="list-inline text-muted">
                        <li title="关注"><i class="fa fa-heart fa-lg"></i>&nbsp;&nbsp;<b class="text-info"><rs:redis key="${startup.fansCountKey}" type="int" /></b></li>
                        <li title="约谈"><i class="fa fa-coffee fa-lg"></i>&nbsp;&nbsp;<b class="text-info"><rs:redis key="${startup.meetCountKey}" type="int" /></b></li>
                        <li title="查看"><i class="fa fa-eye fa-lg"></i>&nbsp;&nbsp;<b class="text-info"><rs:redis key="${startup.viewCountKey}" type="int" /></b></li>
                        <li title="讨论"><i class="fa fa-comments fa-lg"></i>&nbsp;&nbsp;<b class="text-info"><rs:redis key="${startup.discussionCountKey}" type="int" /></b></li>
                      </ul>
                    </div>
	              </div><!-- zz-startup-cell-center -->
	              
	            </div>
	          </c:forEach>
	          
	        </div>
	        
	        <jsp:include page="/WEB-INF/include/page.jsp">
	          <jsp:param name="url" value="/startups"/>
		    </jsp:include>
	        
	      </div><!-- zz-startup-right-layout -->
	      
	    </div>
	  </div>
	
	<%@ include file="/WEB-INF/include/footer.jsp" %>
	<%@ include file="/WEB-INF/include/script.jsp" %>
	<script src="${ctx.resource}/js/jquery.raty.min.js"></script>
	
	<script>
	
	  $(function() {
		
		$('#tag-filters > li > a').on('click', function() {
		  var selectedId = $(this).attr('rel');
		  $('form[name="filter-form"] > input[name="tid"]').val(selectedId);
		  $('form[name="filter-form"]').submit();
		});
		
		$('#region-filters > li > a').on('click', function() {
		  var selectedId = $(this).attr('rel');
		  $('form[name="filter-form"] > input[name="rid"]').val(selectedId);
		  $('form[name="filter-form"]').submit();
		});
		
		$('#fund-status-filters > li > a').on('click', function() {
		  var selectedId = $(this).attr('rel');
		  $('form[name="filter-form"] > input[name="fsid"]').val(selectedId);
		  $('form[name="filter-form"]').submit();
		})
		
		$(".show-rating").raty({
		  path      : "${ctx.resource}/img",
		  half      : true,
		  target    : ".show-rating-hint",
		  readOnly  : true,
		  score     : function() {
		    return $(this).data("score");
		  }
		});
		
		$(".show-rating").each(function() {
		  var score = $(this).data("score");
		  if(score == 0) {
			score = "未评分";
		  }
		  $(this).next().text(score);
		});
		  
	  });
	
	</script>
    
  </body>
  
</html>
